//查
function getCookie(key){
    let strCookie = document.cookie;
    let arrCookie = strCookie.split("; ");   
    for(let i=0; i<arrCookie.length; i++){
        let item = arrCookie[i].split("=");
        if(item[0] == key){
            return item[1];
        }
    }

    return '';
}
//增改
function setCookie(key,value,day){
    if(day == undefined){
        document.cookie = `${key}=${value}`;
    }else{
        let date = new Date();
        date.setDate(date.getDate()+day);
        document.cookie = `${key}=${value};expires=${date}`;
    }
}
//删
function delCookie(key){
    setCookie(key,'',-1);
}
